<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../lib/iconfont4/iconfont.css">
    <link rel="stylesheet" href="../css/reg.css">
    <!-- <link rel="stylesheet" href="../js/idcode/css/jquery.idcode.css"> -->
    <script src="../js/jquery.js"></script>
    <script src="../js/jquery-validation/jquery.validate.min.js"></script>
    <script src="../js/jquery-validation/localization/messages_zh.min.js"></script>
    <script src="../js/layer/layer.js"></script>
    <script src="../js/idcode/js/jquery.idcode.js"></script>
</head>

<body>
    <header>
        <div class="logo_">
            <a href="#"><span class="logo_left"></span></a> <span class="logo_right"></span>
        </div>
    </header>
    <section>
        <div class="form_box">
            <h2>注册也买酒 <a href="#">您可以使用QQ ,微信,微博登陆</a></h2>
            <form action="">
                <dl>
                    <dt>手机号:</dt>
                    <dd><input type="text" placeholder="请输入手机号" name="uname"></dd>
                </dl>
                <dl>
                    <dt>验证码:</dt>
                    <dd id="yzm"><input type="text" id="Txtidcode" class="txtVerification" name="uberprufen"><span id="idcode"></span>
                    </dd>

                </dl>
                <dl>
                    <dt>短信验证码:</dt>
                    <dd><input type="text" class="code" placeholder="请输入手机验证码"></dd>
                    <button type="submit">短信验证码</button>

                </dl>
                <dl>
                    <dt>密 码:</dt>
                    <dd><input type="password" placeholder="请输入密码" name="upwd" id="pwd_confirm"></dd>

                </dl>
                <dl>
                    <dt>密码确认:</dt>
                    <dd><input type="password" placeholder="请确认密码" name="upwd2"></dd>

                </dl>
                <dl class="ckebox">
                    <input type="checkbox" name="ckebox">
                    <span>我有VIP升级码</span>

                </dl>
                <dl class="ckebox1">
                    <input type="checkbox" name="ckebox1" checked>
                    <span>我已经满十八周岁并接受 <a href="#">《也买酒服务条款》</a></span>

                </dl>
                <dl class="finished">
                    <button>注册完成</button>

                </dl>

            </form>
        </div>
        <div class="img_div">
            <a href="#"><img src="../images/login/register_ads.jpg" alt=""></a>
        </div>

        <!-- 右侧登录栏 -->

    </section>
    <footer>
        <div class="fotbox">
            <div class="firstline">
                <span class="one bgc">消费者最喜爱的网站TOP100 </span>
                <span class="line">|</span>
                <span class="two bgc">仅限18周岁以上人士购买</span>
                <span class="line">|</span>
                <span class="three bgc"><a href="#">网络社会征信网</a></span>
                <span class="line">|</span>
                <span class="four bgc">上海工商</span>
                <span class="line">|</span>
                <span>京公网安备11010502013828</span>
            </div>
            <div class="secondLine"><span>Copyright 2006-2015 也买酒 yesmywine.com 版权所有</span><span>|</span>
                <span>沪ICP备17040012号-1</span></div>
            <div class="thirdline"><a href="#"> <img src="../images/login/cert.png" alt=""> <img
                        src="../images/login/lead.jpg" alt=""></a></div>
        </div>
    </footer>
</body>
<script>
    $(function () {
        $.idcode.setCode();
        $("form").validate({
            rules: {
                uname: {
                    required: true,
                    digits: true,
                    rangelength: [11, 11]
                },
                upwd: {
                    required: true,
                    rangelength: [6, 18]
                },
                upwd2: {
                    required: true,
                    equalTo: "#pwd_confirm"
                }
            },
            messages: {
                uname: {
                    required: "手机号不能为空",
                    digits: "请输入正确的手机号",
                    rangelength: "必须是11位有效数字"
                },
                upwd: {
                    required: "密码不能为空",
                    rangelength: "密码长度必须是{0}-{1}位数"
                },
                upwd2: {
                    required: "两次输入的密码必须一致",
                    equalTo: "两次输入的密码必须一致"
                }
               
            },
            submitHandler: function () {
                var schonPass = $.idcode.validateCode()
                // alert(111)
                if (schonPass) {
                    $.ajax({
                        url: "./../../sever/yemaijiuSever.php",
                        data: $("form").serialize(), // 必须和php的uname  upwd保持一致
                        type: 'post',
                        dataType: 'json'
                    }).then(function (res) {
                        if (res.status == 1) {
                            layer.confirm('是否需要立即登录?', {
                                icon: 1,
                                title: res.msg,//提示
                                skin: 'layui-layer-molv',
                                btn: ['是', '否'],
                                time: 5000
                            }, function () {
                                location = "./login.html"
                            }, function (index) {
                                layer.close(index); //关闭
                            });
                        } else {
                            layer.alert(res.msg, {
                                icon: 2,
                                skin: 'layui-layer-molv'
                            })
                        }
                    })
                    return false;

                } else {
                    layer.msg('验证码错误')
                }
                return false

            }
        })
    })
</script>

</html>